﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
using System.Data;
using System.Data.SqlClient;

namespace DAL
{
   public  class News_新闻内容_DAL
    {

        /// <summary>
        /// 显示学霸之路的信息
        /// </summary>
        /// <returns></returns>
       public List<News_新闻内容_> ShowAss()
        {
            using (SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=JingRui;Integrated Security=True"))
            {
                string sql = "select * from [News(新闻内容)]";
                SqlCommand com = new SqlCommand(sql, con);
                SqlDataAdapter sd = new SqlDataAdapter(com);
                DataTable dt = new DataTable();
                sd.Fill(dt);
                List<News_新闻内容_> list = new List<News_新闻内容_>();
                foreach (DataRow item in dt.Rows)
                {
                    News_新闻内容_ a = new News_新闻内容_();
                    a.Newsid = Convert.ToInt32(item["Newsid"]);
                    a.Newsmonth = item["Newsmonth"].ToString();
                    a.Newscontent = item["Newscontent"].ToString();
                    
                  
                    list.Add(a);
                }
                return list;

            }
        }
    }
}
